package com.io;

import org.apache.commons.io.FileUtils;

import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入身份证前六位");
        String num = scanner.nextLine();
        Map<String,String> map = new HashMap<>();
        try {
            List<String> list = FileUtils.readLines(new File("/Users/edy/Desktop/file/身份证所在地.txt"), "UTF-8");
            for (String s : list) {
                String[] split = s.split(",");
                map.put(split[0],split[1]);
            }

            for (Map.Entry<String, String> entry : map.entrySet()) {
                if (entry.getKey().equals(num)) {
                    System.out.println("所在地区为：" + entry.getValue());
                }
            }




        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
